package com.itheima.controller;

import com.itheima.entity.Banner;
import com.itheima.entity.Movies;
import com.itheima.result.Result;
import com.itheima.service.BannerService;
import com.itheima.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("index")
public class IndexController {

    @Autowired
    private BannerService bannerService;

    @Autowired
    private MovieService movieService;

    @GetMapping("findBannerList")
    public Result findBannerList(){
       List<Banner> list = bannerService.findBannerList();
       return Result.success(list);
    }

    @GetMapping("findMovieListMap")
    public Result findMovieListMap(){
        Map<String,List<Movies>> map = movieService.findMovieListMap();
        return Result.success(map);
    }
}
